package com.xindaoapp.happypet.utils;

import android.app.Activity;
import android.graphics.drawable.ColorDrawable;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.PopupWindow;

import com.xindaoapp.happypet.R;

public class BasePopupWindow extends PopupWindow {

    private final Activity context;

    public BasePopupWindow(Activity context) {
        super(context);
        this.context = context;
    }

    public BasePopupWindow init(View view) {
        this.setContentView(view);
        this.setWidth(LinearLayout.LayoutParams.MATCH_PARENT);
        this.setHeight(LinearLayout.LayoutParams.WRAP_CONTENT);
        this.setFocusable(true);
        this.setAnimationStyle(R.style.PopupAnimation);
        this.setBackgroundDrawable(new ColorDrawable(context.getResources().getColor(
                R.color.transparent)));
        setFocusable(true);
        return this;
    }

}
